#pragma once
#include "ISceneNodeCamera.h"
#include "WareEngineNameSpace.h"

BEGIN_WARE

class CSceneCamera : public ISceneNodeCamera
{
public:
	CSceneCamera( uint32 uID );
	~CSceneCamera(void);

	/// IRareUnkown
	virtual int32					Grab()		{ return 0; }
	virtual int32					Drop();

	/// ISceneEntity				
	virtual int32					GetEntityType()				{ return ENTITYNODE_CAMERA; };
	virtual uint32					GetID()						{ return m_uID; };

	virtual ISceneNodeTransform*	GetParent()	{ return m_pParent; }

	virtual VBOOL					Update( IGraphic* pGraphic, uint32 uCurTime );

	virtual VBOOL					Render( IGraphic* pGraphic, uint32 uCurTime )	{ return VTRUE; }
 
	virtual void					CullVisibleObjects( IGraphic* pGraphic, ISceneNodeCamera* pCamera );

	virtual void					SetParent( ISceneNodeTransform* pNode )	{ m_pParent = pNode; };

	virtual void					SetWireFrameMode( VBOOL bWireFrame )	{ m_bWireFrameMode = bWireFrame; }

	virtual void					SetVisible( VBOOL bVisible )	{ m_bVisible = bVisible; }
	virtual VBOOL					IsVisible()						{ return m_bVisible; }

	/// ICamera
	virtual void					GetPos( CVector3& vPos )		{ vPos = m_vPos; }
	virtual void					GetUp( CVector3& vUp )			{ vUp = m_vUp; }
	virtual void					GetTarget( CVector3& vTarget )	{ vTarget = m_vTarget; }
	virtual void					GetDir( CVector3& vDir )		{ vDir = m_vDir; }
	virtual float32					GetAspc()						{ return m_fAspc; }	
	virtual float32					GetFovy()						{ return m_fFovy; }
	virtual float32 				GetNear()						{ return m_fNear; }
	virtual float32 				GetFar()						{ return m_fFar; }

	/// ISceneCamera				
	virtual	void					Orthogonal2D( CVector3& vPos, CVector3& vTarget, CVector3& vUp, float32 fNear, float32 fFar );
	virtual void					Projection3D( CVector3& vPos, CVector3& vTarget, CVector3& vUp, float32 fAspc, float32 fFovy, float32 fNear, float32 fFar );

private:

	void							SetParentNode();

private:

	ISceneNodeTransform*			m_pParent;
	uint32							m_uID;

	float32							m_fAspc;
	float32							m_fFovy;
	float32							m_fNear;
	float32							m_fFar;

	CVector3						m_vPos;
	CVector3						m_vTarget;
	CVector3						m_vUp;
	CVector3						m_vDir;

	VBOOL							m_bVisible;
	VBOOL							m_bWireFrameMode;

};

END_WARE
